using System;
using System.Collections.Generic;
using System.Text;

namespace csammisrun.MsnLib
{
  /// <summary>
  /// Identifies errors that can occur during an MSN session
  /// </summary>
  public enum MsnErrorCode
  {
    /// <summary>
    /// The server is unavailable
    /// </summary>
    ServerUnavailable,
    /// <summary>
    /// Username/password authentication failed
    /// </summary>
    AuthenticationFailed,
    /// <summary>
    /// MsnLib's protocol version is not supported by the server
    /// </summary>
    ProtocolVersionNotSupported,
    /// <summary>
    /// The MSN server is shutting down
    /// </summary>
    ServerShuttingDown,
    /// <summary>
    /// Someone else has successfully signed in with the same username
    /// </summary>
    SignedInElsewhere
  }

  /// <summary>
  /// Describes the steps that occur during MSN login
  /// </summary>
  public enum LoginStep
  {
    /// <summary>
    /// The initial server connection has been made
    /// </summary>
    StepOneConnectedToServer,
    /// <summary>
    /// MsnLib has connected to the nexus to get login server information
    /// </summary>
    StepTwoConnectedToNexus,
    /// <summary>
    /// The login server authentication challenge is in progress
    /// </summary>
    StepThreeConnectedToLoginServer,
    /// <summary>
    /// The login server has authenticated the user
    /// </summary>
    StepFourAuthenticated,
    /// <summary>
    /// The notification server is syncing the local contact list
    /// </summary>
    StepFiveSyncing
  }

  /// <summary>
  /// Describes possible login failures
  /// </summary>
  public enum LoginFailure
  {
    /// <summary>
    /// <see cref="Session.Username"/> is not a valid MSN Passport
    /// </summary>
    UnknownUsername,
    /// <summary>
    /// The supplied password is incorrect
    /// </summary>
    BadPassword,
    /// <summary>
    /// The MSN notification server is unavailable
    /// </summary>
    CouldntConnectToService,
    /// <summary>
    /// The MSN Nexus is unavailable
    /// </summary>
    CouldntConnectToNexus
  }

  /// <summary>
  /// Describes client capabilities
  /// </summary>
  public enum ClientCapabilities
  {
    WinMobile = 0x00001,
    Unknown1 = 0x00002,
    InkGif = 0x00004,
    InkIsf = 0x00008,
    VideoChat = 0x00010,
    Basic = 0x00020,
    MsnMobile = 0x00040,
    MsnDirectConnect = 0x00080,
    WebMessenger = 0x00100,
    DirectIM = 0x04000,
    Winks = 0x08000,
    Search = 0x10000
  }

  internal class PassportInfo
  {
    private string _kv = "";
    private string _sid = "";
    private string _mspauth = "";
    private long _sl = 0;
    private string _redirecter = "";
    private string _clientip = "";
    private int _clientport = 0;

    public string Kv
    {
      get { return _kv; }
      set { _kv = value; }
    }

    public string Sid
    {
      get { return _sid; }
      set { _sid = value; }
    }

    public string Auth
    {
      get { return _mspauth; }
      set { _mspauth = value; }
    }
    
    public long Sl
    {
      get { return _sl; }
      set { _sl = value; }
    }

    public string Redirecter
    {
      get { return _redirecter; }
      set { _redirecter = value; }
    }

    public string ClientIP
    {
      get { return _clientip; }
      set { _clientip = value; }
    }

    public int ClientPort
    {
      get { return _clientport; }
      set { _clientport = value; }
    }
  }
}